package com.cbgolf.oa.receiver;

import android.content.Context;
import android.util.Log;
import com.alibaba.sdk.android.push.MessageReceiver;
import com.alibaba.sdk.android.push.notification.CPushMessage;
import com.cbgolf.oa.manager.ReceiverManager;
import java.util.Map;

/**
 * @author lq
 */
public class AliReceiver extends MessageReceiver {

  // 消息接收部分的LOG_TAG
  public static final String REC_TAG = "receiver";

  @Override
  public void onNotification(Context context, String title, String summary,
      Map<String, String> extraMap) {
    // TODO 处理推送通知
    Log.e("ali-onNotifica--------",
        "Receive notification, title: " + title + ", summary: " + summary + ", extraMap: "
            + extraMap);
  }

  @Override
  public void onMessage(Context context, CPushMessage cPushMessage) {
    Log.e("ali-onMessage----------",
        "onMessage, messageId: " + cPushMessage.getMessageId() + ", title: " + cPushMessage
            .getTitle() + ", content:" + cPushMessage.getContent());
    ReceiverManager.getInstance().showMessage(context, cPushMessage);

  }

  @Override
  public void onNotificationOpened(Context context, String title, String summary, String extraMap) {
    Log.e("ali-onNotifi-Open-----",
        "onNotificationOpened, title: " + title + ", summary: " + summary + ", extraMap:"
            + extraMap);
    ReceiverManager.getInstance().onNotificationOpened(context, extraMap);
  }

  @Override
  protected void onNotificationClickedWithNoAction(Context context, String title, String summary,
      String extraMap) {
    Log.e("onNotifi-ClickedWith--",
        "onNotificationClickedWithNoAction, title: " + title + ", summary: " + summary
            + ", extraMap:" + extraMap);
  }

  @Override
  protected void onNotificationReceivedInApp(Context context, String title, String summary,
      Map<String, String> extraMap, int openType, String openActivity, String openUrl) {
    Log.e("ali in app------------",
        "onNotificationReceivedInApp, title: " + title + ", summary: " + summary + ", extraMap:"
            + extraMap + ", openType:" + openType + ", openActivity:" + openActivity + ", openUrl:"
            + openUrl);
  }

  @Override
  protected void onNotificationRemoved(Context context, String messageId) {
    Log.e("ali-remove-not---------", "onNotificationRemoved");
  }
}